import java.util.Scanner;

public class Atividade12 {
	public static void main(String arg[]){
		Scanner digitar = new Scanner(System.in);
		int soma=0;
		int num[]= new int[8];
		for (int i=0;i<8;i++){
			num[i]=digitar.nextInt();
			if (num[i]>5 && num[i]<10){
				soma += num[i];
			}
		}
		System.out.println(soma);
	}

}
